

package edu.faytechcc.csc251.elementalTD;

import java.awt.event.*;
import java.awt.*;

/**
 * Is used to define the mouse && keyboard events
 * @author William Robles
 */
public class ActionHandle implements MouseMotionListener, MouseListener, KeyListener
{

    @Override
    public void mouseDragged(MouseEvent e)
    {
        GameDisplay.mse = new Point((e.getX()) - ((MainFrame.size.width - GameDisplay.myWidth)/2),
                        (e.getY()) - ((MainFrame.size.height - GameDisplay.myHeight)/2));
    }

    @Override
    public void mouseMoved(MouseEvent e)
    {
        GameDisplay.mse = new Point((e.getX()) - ((MainFrame.size.width - GameDisplay.myWidth)/2),
                        (e.getY()) - ((MainFrame.size.height - GameDisplay.myHeight)/2));
    }

    @Override
    public void mouseClicked(MouseEvent e)
    {
        try
        {
            GameDisplay.gameComps.click(e.getID());
        }
        catch (CloneNotSupportedException ex)
        {
            System.out.println("OMG NOT CLONING");
        }
        GameDisplay.click(e.getID());
    }

    @Override
    public void mousePressed(MouseEvent e)
    {
        try
        {
            GameDisplay.gameComps.click(e.getID());
        }
        catch (CloneNotSupportedException ex)
        {
            System.out.println("OMG NOT CLONING");
        }
    }

    @Override
    public void mouseReleased(MouseEvent e)
    {
        try
        {
            GameDisplay.gameComps.click(e.getID());
        }
        catch (CloneNotSupportedException ex)
        {
            System.out.println("OMG NOT CLONING");
        }
    }

    @Override
    public void mouseEntered(MouseEvent e)
    {
        
    }

    @Override
    public void mouseExited(MouseEvent e)
    {
        
    }

    @Override
    public void keyTyped(KeyEvent e)
    {
        Mob.setShowHealth(e.getKeyChar());
    }

    @Override
    public void keyPressed(KeyEvent e)
    {
        
    }

    @Override
    public void keyReleased(KeyEvent e)
    {
        
    }
    
}
